{extend name="panel/layout" /}
{block name="main"}
<div class="row">
    <div class="col-sm-12">
        <h4 class="page-title">
            <ul class="breadcrumb">
                <li><i class="fa fa-home"></i><a href="/"> 首页</a></li>
                <li><i class="fa fa-desktop"></i><a href="{:url('index')}"> 控制面板</a></li>
                <li class="active">自助下单</li>
            </ul>
        </h4>
    </div>
</div>
<div class="row">
    <div class="col-xs-12">
        <div class="panel panel-danger">
            <div class="panel-heading">
                <h3 class="panel-title" align="center">下单说明！</h3>
            </div>
            {:getHtmlCode(config('web_gg_dgadd'))}
        </div>
    </div>
</div>

<div class="row">
    <div class="col-lg-12">
        <div class="panel panel-warning">
            <div class="panel-heading">
                自助下单
						<span class="pull-right">
							<label class="label-checkbox inline">
                                剩余金币：{$userInfo.point}
                            </label>
						</span>
            </div>

            <div class="panel-body">
                <form method="post" class="form-horizontal">
				<input type="hidden" name="mod" value="coin">
                    <div class="form-group">
                        <label class="control-label col-md-2">选择下单QQ</label>
                        <div class="col-md-10">
                            <select class="form-control" name="qid">
                                {volist name="qqList" id="qq"}
                                <option value="{$qq.qid}" {if condition="$qq.qid eq $aqid"}selected{/if}>{$qq.uin}</option>
                                {/volist}
                            </select>
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="control-label col-md-2">代挂项目</label>
                        <div class="col-md-10">
                            <select class="form-control" name="tid" id="dgtid" onchange="getPoint();">
                                {volist name="toolList" id="tool"}
                                <option value="{$tool.tid}" price="{$tool.price}">{$tool.name}</option>
                                {/volist}
                            </select>
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="control-label col-md-2">下单月数</label>
                        <div class="col-md-10">
                            <div class="input-group">
                                <input type="number" name="num" value="1" id="num" class="form-control"
                                       onchange="getPoint();" required>
                                <div class="input-group-addon">月</div>
                            </div>
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="control-label col-md-2">消耗金币</label>
                        <div class="col-md-10">
                            <div class="input-group">
                                <input type="text" value="{$price_all}" class="form-control" id="need"
                                       disabled>
                                <div class="input-group-addon">个</div>
                            </div>
                        </div>
                    </div>

                    <div class="form-group">
                        <label class="control-label col-md-2"></label>
                        <div class="col-md-10">
                            <button class="btn btn-primary" type="submit">确认下单</button>
                            <button class="btn btn-default-outline" type="reset">重置</button>
                        </div>
                    </div>
                </form>
            </div>
        </div>
		<div class="panel panel-info">
            <div class="panel-heading">
                卡密下单
            </div>

            <div class="panel-body">
                <form method="post" class="form-horizontal">
				<input type="hidden" name="mod" value="kami">
                    <div class="form-group">
                        <label class="control-label col-md-2">选择下单QQ</label>
                        <div class="col-md-10">
                            <select class="form-control" name="qid">
                                {volist name="qqList" id="qq"}
                                <option value="{$qq.qid}" {if condition="$qq.qid eq $aqid"}selected{/if}>{$qq.uin}</option>
                                {/volist}
                            </select>
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="control-label col-md-2">代挂项目</label>
                        <div class="col-md-10">
                            <div class="input-group">
                                <input type="text" class="form-control"
                                       value="全套代挂" disabled>
									   <div class="input-group-addon"></div>
                            </div>
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="control-label col-md-2">代挂卡密</label>
                        <div class="col-md-10">
                            <div class="input-group">
                                <input type="text" name="km" id="km" class="form-control"
                                       placeholder="代挂卡密不是余额卡密，请仔细分辨！" required>
                                <div class="input-group-addon"></div>
                            </div>
                        </div>
                    </div>

                    <div class="form-group">
                        <label class="control-label col-md-2"></label>
                        <div class="col-md-10">
                            <button class="btn btn-primary" type="submit">确认下单</button>
                            <button class="btn btn-default-outline" type="reset">重置</button>
                        </div>
                    </div>
                </form>
            </div>
        </div>
    </div>
</div>
{/block}
{block name="footJs"}
<script type="text/javascript">
    function getPoint() {
        var value = $('#num').val();
        var tid = $('#dgtid option:selected').val();
        var price = {$price_dx};
        if (tid == 1) {
            price = {$price_all};
        }
        $('#need').val((value * price).toFixed(2));
    }
</script>
{/block}
